< previous page page_480 next page >

Page 480
The dbFind Dialog Box
Now you're ready to build the dialog box that displays the selection list to the user. Add a new form to the custom control project and set its name to frmFind; its BorderStyle to 3; its ControlBox property to False; and its StartUpPosition to 2. Then add a data-bound list control and a single command button to the form. Copy the command button. Select the command button and then select Edit | Copy and Edit | Paste from the menu. Be sure to answer Yes when asked if you want to create a control array. Finally, add a data control to the form and set its visible property to False. Also, set the DBList1 control's DataSource property to Data1. Your form should look something like the one in Figure 12.19.
0480-01.jpg
Figure 12.19.
Laying out the frmFind form.
Don't worry about placing the controls on the form, you'll do that at runtime using Visual Basic code. Now save the form (FRMFIND.FRM) and the project (DBFINDCTL.VBP) before going to the next step.
Now it's time to code the frmFind form. First, add the following lines to the general declaration section of the form:
Option Explicit
'
Private blnCloseFlag As Boolean
Private varSelectValue As Variant
This code declares local storage for two form-level custom properties. Now add the CloseFlag Property (select Tools | Add Procedure) and enter the code from Listing 12.18.

 
< previous page page_480 next page >

If you like this book, buy it!